feat: Android host adapter (android/truapi-host) + hosts/android submodule - #289
feat: Android host adapter (android/truapi-host) + hosts/android submodule#289TarikGul wants to merge 28 commits into
Conversation
|
will test it out One note before before I look into the code. I am a bit surprised that this work without some of the changes to the signing host that I pushed to |
|
@pgherveou Calrification: so signing did fail with the ring-vrf path which was expected but for sr25519 signing worked fine. I only used the signing host - no pairing at all. This is the list of pass fail: |
|
Holding this until #288 lands. Two things depend on it:
Once #288 is in the mobile base I'll wire |
…uapi into feat/signing-host-ring-vrf
Use codec-derived runtime payloads and metadata-aware storage projections so field ordering and variant encoding stay aligned with chain types. Derive SSO message labels once and keep normal transcript events at debug.
45bb321 to
8f8255d
Compare
Add the android/truapi-host package (Kotlin host adapter shell over the truapi-server UniFFI core, localhost WebSocket bridge transport) matched to the current core FFI surface: HostCoreStorage, a single confirmUserAction, local signing session activation, and LocalhostBridgeBootstrap. Add Makefile targets uniffi-kotlin (Kotlin binding generation), android-jni (cargo-ndk cross-compile of libtruapi_server.so per ABI), and android-publish-local; gitignore the generated bindings and jniLibs.
- android-publish-local no longer depends on android-jni: the AAR does not bundle the cdylib, so publishing only needs the Kotlin bindings (JitPack has no NDK). - README: flag that the JitPack distribution is not yet wired up (no jitpack.yml at the repo root) and document the INTERNET permission the consuming app must declare.
…dule Mirror hosts/ios: vendor the Android app at hosts/android (tracking branch tg/truapi-rust-core) so the truapi repo can build and diagnose the app against its own core. .gitmodules uses the HTTPS URL to match hosts/ios; document the mobile host adapter packages and host submodules in the README layout.
Advance the submodule pin to include DefaultHostBridge + WebSocketChainProvider and the connected-session diagnostics test, so the vendored app builds and diagnoses against a working host.
Advance the hosts/android submodule to the hardened host bridge (deny-by-default confirmations, lifecycle/storage fixes) and add a check-android-parity make target that fails if the canonical android/truapi-host TrUAPIHost.kt shell drifts from the copy vendored in the app (hosts/android). The target skips cleanly when the submodule is not initialized, so it is safe to run in any checkout and to wire into CI.
75f288d to
1c73b49
Compare
|
Depends on #215 — that needs to land before this one. The Kotlin package in
This PR's base ( Merge order: #288 → #215 → this. To build the Android host before #215 lands, point the consuming app's |
Android TrUAPI host adapter
Brings Android to parity with the iOS host adapter (
ios/truapi-host): the truapi repo owns a Kotlin host-adapter package, and vendors the Android app as a submodule so the core can be built and diagnosed against it.What this adds
android/truapi-host/— the Kotlin host-adapter package over thetruapi-serverUniFFI core, the analogue ofios/truapi-host.TrUAPIHost.ktexposes the current FFI surface:HostBridge(device/remote permission split, a singleconfirmUserAction,chainConnect/Send/Close,lookupPreimage, theme, feature support),HostStorage+HostCoreStorage,TrUAPIHostCore(WS-bridge lifecycle, local-session activation, permission-authorization status, native change notifications), andLocalhostBridgeBootstrap. Products in a WebView reach the core over the localhost WebSocket bridge; the core signs on-device (signing-host role) with no separate phone.Build tooling (
Makefile):uniffi-kotlin(generate Kotlin bindings),android-jni(cargo-ndk cross-compile oflibtruapi_server.soper ABI), andandroid-publish-local.check-android-parityfails if the canonicalTrUAPIHost.ktshell drifts from the copy vendored in the app (skips cleanly when the submodule is uninitialized). Generated bindings andjniLibsare gitignored.hosts/androidsubmodule — vendorspolkadot-app-android-v2(branchtg/truapi-rust-core), mirroringhosts/ios..gitmodulesuses the HTTPS URL. Its app-side integration (abindings/truapi-hostrust-android module, a functionalDefaultHostBridge+WebSocketChainProvider, and an instrumented diagnostics harness) lives in that repo's companion PR.Verified on an Android emulator
The vendored app drives the host playground through the core end-to-end: the built-in Diagnosis sweep runs every TrUAPI method, with on-device signing/ permission approval prompts (no phone). All Signing methods pass and sign
locally; Account/Entropy/Local Storage/Notifications/Permissions pass. Remaining failures are funding/allowance-gated (Payment needs a balance; Preimage/Resource Allocation need on-chain allowances) or unimplemented on this host (Chat), consistent with the deployed-host diagnosis.
Notes
ios/truapi-host(no default-host/chain-provider helpers — those are app-side).TrUAPIHost.ktis duplicated between here and the vendored app copy;make check-android-parityguards against drift until it's single-sourced.jitpack.yml); local integration usesmake android-publish-local+mavenLocal(). Noted inandroid/truapi-host/README.md.